package com.holly.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.holly.mapper.OperateLogMapper;
import com.holly.pojo.OperateLog;
import com.holly.pojo.PageResultData;
import com.holly.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author holly
 * @create 2025-07-08 14:39
 */
@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private OperateLogMapper operateLogMapper;
    @Override
    public PageResultData<OperateLog> page(Integer pageNum, Integer pageSize) {
        //设置分页查询参数
        PageHelper.startPage(pageNum,pageSize);
        //执行查询
        List<OperateLog> operateLogList = operateLogMapper.page(pageNum,pageSize);
        //解析结果，并封装
        Page<OperateLog> page = (Page<OperateLog>) operateLogList;
        return new PageResultData<>(page.getTotal(),page.getResult());
    }
}
